# build image
cd build_erlang
docker build -t erlang-docker .
echo ">> image done...\n\n"

# build redis
docker pull redis
echo ">> redis done...\n\n"

# build application
cd ../build_app
docker build -t myapp .
echo ">> app done...\n\n"

# run redis
docker run --name myredis -d \
-v redis.conf:/usr/local/etc/redis/redis.conf \
-v /redis/data:/data \
-p 7000:6379 \
redis redis-server /usr/local/etc/redis/redis.conf

# run application
docker run --name myapp -d -p 8080:8080 --link myredis:myredis myapp

echo ">> success."